1 using UnityEngine;
2 using
System.Collections;
3
4 public
class EnemyMovement : MonoBehaviour {
5
6     GameObject player;
7     UnityEngine.AI.NavMeshAgent nav;
8
9     
// Use this for initialization
10     
void Start () {
11         player = GameObject.FindGameObjectWithTag (
"Player");
12         nav = GetComponent<UnityEngine.AI.NavMeshAgent> ();
13     }
14     
15     
// Update is called once per frame
16     
void Update () {
17         
if (nav.enabled == false)
18             
return;
19         nav.SetDestination (player.transform.position);
20     
21     }
22 }


Gõ tìm kiếm nhanh...